#ifndef BNETSPY_H
#define BNETSPY_H

#include <qprocess.h>
#include <qtabdialog.h>
#include <qtabbar.h>

//////////////////////////////
// GUI Widgets.
//////////////////////////////
#include "BnetJoinHelpSettingsWidget.h"
#include "BnetLoggerSettingsWidget.h"
#include "AboutWidget.h"

//////////////////////////////
// Non-GUI objects.
//////////////////////////////
// 
// BnetLogger.
#include "BnetLogger.h"

// Registry Editor.
#include "StarcraftRegistryEditor.h"

class BnetSpy : public QTabDialog 
{
Q_OBJECT

 public:
    BnetSpy( QWidget * parent = 0, 
	     const char * name = 0, 
	     bool modal = FALSE, 
	     WFlags f = 0 );

signals:
 void writeJoinGame( const QString& gameName );
 
public slots:
    void applyClicked();
    void runStarcraft();

    bool loadSettings();
    bool saveSettings();
    
    void parseForJoinHelp( BnetMessage msg );
private:
    // Unimplemented functions.
    BnetSpy( const BnetSpy& toCopy );
    BnetSpy& operator=( const BnetSpy& rhs );
    
    enum { MagicNumber = 0x32f56b2a };  // This is stored as the header
                                        // to every data file saved, to
                                        // ensure it's a valid saved file.


    bool loadBool( QDataStream& in );   // Gets a C++ bool from a QDataStream.
    const Q_UINT32 FileVersion;     // File format version.
    

    const QString saveDataFilename; // Default save filename.

    // Settings values.
    bool joinHelpEnabled_;
    bool loggerEnabled_;
    bool logUserInChannelEnabled_;
    bool logUserJoinLeaveEnabled_;
    QString loggerFilename_;

    // Tabs.
    QTab* bnetJoinHelpTab;
    QTab* bnetLoggerTab;
    QTab* aboutTab;
    
    // Tab widgets.
    BnetJoinHelpSettingsWidget* joinHelpWidget;
    BnetLoggerSettingsWidget*   loggerWidget;
    AboutWidget*                aboutWidget;

    QProcess* starcraftProcess_;
    
    BnetLogger* logger_;
    StarcraftRegistryEditor* regEditor_;
};

#endif
